<!DOCTYPE html>
<html>

<head lang="en">
    <meta charset="UTF-8">
    <title></title>
</head>

<body>
    <script>
        //【1】concat（）方法，用于连接两个或多个数组。@@@不改变原有数组，返回值为新数组
        var arr2 = [1, 2, 3, 4, 5];
        var arr2_change = arr2.concat(6, 7);
        console.log(arr2); //[1, 2, 3, 4, 5]//原有数组不会改变
        console.log(arr2_change); //[1, 2, 3, 4, 5, 6, 7]//返回值是新的数组
        var arr2_again = arr2.concat([1, 2, 3]);
        console.log(arr2_again); //[1, 2, 3, 4, 5, 1, 2, 3]
        var and = arr2.concat([1, 2, 3], [33, 22]); //可以传入多个数组
        console.log(and); //[1, 2, 3, 4, 5, 1, 2, 3, 33, 22]
        //【2】数组的复制
        var arr_sky = [1, 3, 5];
        var arr_moon = arr_sky.concat();
        arr_sky.push(7);
        console.log(arr_sky); //[1, 3, 5,7];
        console.log(arr_moon); //[1, 3, 5];
    </script>
</body>

</html>